<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        img {
            width: 50%;
        }
    </style>
</head>

<body>
    <img id="img1" src="https://www.imagesource.com/wp-content/uploads/2019/06/Rio.jpg">
    <p id="p1">loading...</p>
    <script type="text/javascript">
        function imgLoad(img, callback) {
            var timer = setInterval(function() {
                if(img.complete) {
                    callback(img)
                    clearInterval(timer)
                }
            }, 50)
        }

        imgLoad(img1,function() {
            console.log("loaded");
            p1.innerHTML = "加载完毕"
        })
    </script>
</body>

</html>